/**
 *
 * @author Erivaldo Lourenco
 * @author Juliana Cavalcanti
 * 
 */

package br.ufal.ic.p3.Interface.cliente;

import javax.swing.JInternalFrame;



import br.ufal.ic.p3.Interface.TelaPrincipal;

import br.ufal.ic.p3.Interface.cliente.juridico.CadastroClienteJuridico;

import br.ufal.ic.p3.Interface.funcionario.CadastroFuncionario;

import br.ufal.ic.p3.controle.ControleCliente;
import javax.swing.GroupLayout.Alignment;
import javax.swing.GroupLayout;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.Color;
import javax.swing.ImageIcon;

public class CadastroCliente extends JInternalFrame {

    public CadastroCliente() {
        super("ProgNet - Cadastro Cliente"); 
        getContentPane().setBackground(Color.WHITE);
        initComponents();
    }

    @SuppressWarnings("unchecked")
    
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        labelEndereco = new javax.swing.JLabel();
        campoRua = new javax.swing.JTextField();
        campoCidade = new javax.swing.JTextField();
        labelRua = new javax.swing.JLabel();
        botaoVoltar = new javax.swing.JButton();
        botaoSalvar = new javax.swing.JButton();
        labelContato = new javax.swing.JLabel();
        labelEmail = new javax.swing.JLabel();
        campoEmail = new javax.swing.JTextField();
        campoTelefone1 = new javax.swing.JTextField();
        labelTelefone1 = new javax.swing.JLabel();
        labelTelefone2 = new javax.swing.JLabel();
        campoTelefone2 = new javax.swing.JTextField();
        labelCidade = new javax.swing.JLabel();
        labelUF = new javax.swing.JLabel();
        campoUF = new javax.swing.JComboBox();
        campoBairro = new javax.swing.JTextField();
        labelBairro = new javax.swing.JLabel();
        campoCEP = new javax.swing.JTextField();
        labelCEP = new javax.swing.JLabel();
        campoCPF = new javax.swing.JTextField();
        campoSobrenome = new javax.swing.JTextField();
        labelSobrenome = new javax.swing.JLabel();
        campoNome = new javax.swing.JTextField();
        labelNome = new javax.swing.JLabel();
        labelDadosPessoais = new javax.swing.JLabel();
        labelCPF = new javax.swing.JLabel();
        barraMenu = new javax.swing.JMenuBar();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(255, 255, 255));

        labelEndereco.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        labelEndereco.setText("Endereco");

        campoRua.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoRuaActionPerformed(evt);
            }
        });

        campoCidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoCidadeActionPerformed(evt);
            }
        });

        labelRua.setText("Rua");

        botaoVoltar.setIcon(new ImageIcon(CadastroCliente.class.getResource("/br/ufal/ic/p3/imagens/voltar.png"))); // NOI18N
        botaoVoltar.setText("Voltar");
        botaoVoltar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	setVisible(false);
            }
        });
        
        botaoSalvar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/ufal/ic/p3/imagens/salvar.png"))); // NOI18N
        botaoSalvar.setText("Salvar");
        botaoSalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	ControleCliente controle = new ControleCliente();
               
            	controle.adicionarCliente(campoNome.getText(), campoSobrenome.getText(), 
            			campoCPF.getText(), campoRua.getText(), campoCidade.getText(), 
            			campoUF.getSelectedItem(), campoCEP.getColumns(), 
            			campoBairro.getText(), campoTelefone1.getText(), 
            			campoTelefone2.getText(), campoEmail.getText());
                
            }
        });

        labelContato.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        labelContato.setText("Contato");

        labelEmail.setText("E-mail");

        campoEmail.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoEmailActionPerformed(evt);
            }
        });

        labelTelefone1.setText("Telefone Residencial");

        labelTelefone2.setText("Telefone Pessoal");

        labelCidade.setText("Cidade");

        labelUF.setText("UF");

        campoUF.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"", "AC", "AL", "AM", "AP", "BA", "CE", "DF", "ES", "GO", "MA", "MG", "MS", "MT", "PA", "PB", "PE", "PI", "PR", "RJ", "RN", "RO", "RS", "SC", "SE", "SP", "TO"}));

        campoBairro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoBairroActionPerformed(evt);
            }
        });

        labelBairro.setText("Bairro");

        labelCEP.setText("CEP");

        campoSobrenome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoSobrenomeActionPerformed(evt);
            }
        });

        labelSobrenome.setText("Sobrenome");

        campoNome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoNomeActionPerformed(evt);
            }
        });

        labelNome.setText("Nome");

        labelDadosPessoais.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        labelDadosPessoais.setText("Dados Pessoais");

        labelCPF.setText("CPF");

        setJMenuBar(barraMenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        layout.setHorizontalGroup(
        	layout.createParallelGroup(Alignment.LEADING)
        		.addGroup(layout.createSequentialGroup()
        			.addContainerGap()
        			.addGroup(layout.createParallelGroup(Alignment.LEADING)
        				.addGroup(layout.createParallelGroup(Alignment.TRAILING, false)
        					.addGroup(layout.createSequentialGroup()
        						.addGroup(layout.createParallelGroup(Alignment.LEADING)
        							.addGroup(layout.createSequentialGroup()
        								.addGroup(layout.createParallelGroup(Alignment.LEADING)
        									.addComponent(labelCidade)
        									.addComponent(campoCidade, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE))
        								.addGap(47)
        								.addGroup(layout.createParallelGroup(Alignment.LEADING)
        									.addComponent(campoUF, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        									.addComponent(labelUF)))
        							.addComponent(labelEmail)
        							.addComponent(campoEmail, GroupLayout.PREFERRED_SIZE, 309, GroupLayout.PREFERRED_SIZE))
        						.addGap(38)
        						.addGroup(layout.createParallelGroup(Alignment.TRAILING)
        							.addGroup(layout.createSequentialGroup()
        								.addComponent(labelTelefone1)
        								.addPreferredGap(ComponentPlacement.RELATED, 137, Short.MAX_VALUE))
        							.addGroup(layout.createSequentialGroup()
        								.addGroup(layout.createParallelGroup(Alignment.TRAILING)
        									.addComponent(campoTelefone1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
        									.addGroup(layout.createSequentialGroup()
        										.addPreferredGap(ComponentPlacement.RELATED)
        										.addGroup(layout.createParallelGroup(Alignment.LEADING)
        											.addComponent(labelBairro)
        											.addComponent(campoBairro, GroupLayout.PREFERRED_SIZE, 220, GroupLayout.PREFERRED_SIZE))))
        								.addGap(32)))
        						.addGap(10)
        						.addGroup(layout.createParallelGroup(Alignment.LEADING)
        							.addComponent(campoTelefone2, GroupLayout.PREFERRED_SIZE, 224, GroupLayout.PREFERRED_SIZE)
        							.addGroup(layout.createParallelGroup(Alignment.TRAILING)
        								.addGroup(layout.createParallelGroup(Alignment.LEADING)
        									.addComponent(labelCEP)
        									.addComponent(campoCEP, GroupLayout.PREFERRED_SIZE, 224, GroupLayout.PREFERRED_SIZE))
        								.addGroup(layout.createSequentialGroup()
        									.addComponent(labelTelefone2)
        									.addGap(127)))))
        					.addGroup(layout.createSequentialGroup()
        						.addGroup(layout.createParallelGroup(Alignment.LEADING)
        							.addComponent(labelNome)
        							.addComponent(campoNome, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE))
        						.addGap(51)
        						.addGroup(layout.createParallelGroup(Alignment.LEADING)
        							.addComponent(labelSobrenome)
        							.addComponent(campoSobrenome, GroupLayout.PREFERRED_SIZE, 494, GroupLayout.PREFERRED_SIZE)))
        					.addGroup(layout.createSequentialGroup()
        						.addComponent(botaoVoltar)
        						.addPreferredGap(ComponentPlacement.UNRELATED)
        						.addComponent(botaoSalvar, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)))
        				.addComponent(campoCPF, GroupLayout.PREFERRED_SIZE, 337, GroupLayout.PREFERRED_SIZE)
        				.addComponent(labelCPF)
        				.addComponent(labelDadosPessoais)
        				.addComponent(labelEndereco)
        				.addComponent(labelRua)
        				.addComponent(labelContato)
        				.addComponent(campoRua, GroupLayout.PREFERRED_SIZE, 838, GroupLayout.PREFERRED_SIZE))
        			.addContainerGap(75, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
        	layout.createParallelGroup(Alignment.LEADING)
        		.addGroup(layout.createSequentialGroup()
        			.addContainerGap()
        			.addComponent(labelDadosPessoais)
        			.addGap(28)
        			.addGroup(layout.createParallelGroup(Alignment.TRAILING)
        				.addGroup(layout.createSequentialGroup()
        					.addComponent(labelNome)
        					.addPreferredGap(ComponentPlacement.RELATED)
        					.addComponent(campoNome, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        				.addGroup(layout.createSequentialGroup()
        					.addComponent(labelSobrenome)
        					.addPreferredGap(ComponentPlacement.RELATED)
        					.addComponent(campoSobrenome, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
        			.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        			.addComponent(labelCPF)
        			.addPreferredGap(ComponentPlacement.RELATED)
        			.addComponent(campoCPF, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        			.addGap(31)
        			.addComponent(labelEndereco)
        			.addGap(12)
        			.addComponent(labelRua)
        			.addPreferredGap(ComponentPlacement.UNRELATED)
        			.addComponent(campoRua, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        			.addGap(18)
        			.addGroup(layout.createParallelGroup(Alignment.TRAILING)
        				.addGroup(layout.createSequentialGroup()
        					.addComponent(labelCEP, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE)
        					.addPreferredGap(ComponentPlacement.RELATED)
        					.addComponent(campoCEP, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        					.addGap(47)
        					.addGroup(layout.createParallelGroup(Alignment.BASELINE)
        						.addComponent(labelTelefone2)
        						.addComponent(labelTelefone1))
        					.addPreferredGap(ComponentPlacement.RELATED)
        					.addGroup(layout.createParallelGroup(Alignment.BASELINE)
        						.addComponent(campoTelefone1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        						.addComponent(campoTelefone2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        					.addGap(6))
        				.addGroup(layout.createSequentialGroup()
        					.addGroup(layout.createParallelGroup(Alignment.LEADING)
        						.addGroup(layout.createSequentialGroup()
        							.addComponent(labelCidade, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE)
        							.addPreferredGap(ComponentPlacement.RELATED)
        							.addGroup(layout.createParallelGroup(Alignment.BASELINE)
        								.addComponent(campoCidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        								.addComponent(campoUF, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        							.addGap(19))
        						.addGroup(layout.createSequentialGroup()
        							.addGroup(layout.createParallelGroup(Alignment.BASELINE)
        								.addComponent(labelUF, GroupLayout.DEFAULT_SIZE, 17, Short.MAX_VALUE)
        								.addComponent(labelBairro, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE))
        							.addPreferredGap(ComponentPlacement.RELATED)
        							.addComponent(campoBairro, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        							.addGap(18)))
        					.addComponent(labelContato)
        					.addPreferredGap(ComponentPlacement.UNRELATED)
        					.addComponent(labelEmail)
        					.addPreferredGap(ComponentPlacement.RELATED)
        					.addComponent(campoEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        					.addGap(4)))
        			.addGap(18)
        			.addGroup(layout.createParallelGroup(Alignment.BASELINE)
        				.addComponent(botaoSalvar, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE)
        				.addComponent(botaoVoltar))
        			.addContainerGap())
        );
        getContentPane().setLayout(layout);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void campoRuaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoRuaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoRuaActionPerformed

    private void campoEmailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoEmailActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoEmailActionPerformed

    private void campoCidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoCidadeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoCidadeActionPerformed

    private void campoSobrenomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoSobrenomeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoSobrenomeActionPerformed

    private void campoNomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoNomeActionPerformed
        
    }//GEN-LAST:event_campoNomeActionPerformed

    private void campoBairroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoBairroActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoBairroActionPerformed
    private javax.swing.JMenuBar barraMenu;
    private javax.swing.JButton botaoVoltar;
    private javax.swing.JButton botaoSalvar;
    private javax.swing.JTextField campoBairro;
    private javax.swing.JTextField campoCEP;
    private javax.swing.JTextField campoCPF;
    private javax.swing.JTextField campoCidade;
    private javax.swing.JTextField campoEmail;
    private javax.swing.JTextField campoNome;
    private javax.swing.JTextField campoRua;
    private javax.swing.JTextField campoSobrenome;
    private javax.swing.JTextField campoTelefone1;
    private javax.swing.JTextField campoTelefone2;
    private javax.swing.JComboBox campoUF;
    private javax.swing.JLabel labelBairro;
    private javax.swing.JLabel labelCEP;
    private javax.swing.JLabel labelCPF;
    private javax.swing.JLabel labelCidade;
    private javax.swing.JLabel labelContato;
    private javax.swing.JLabel labelDadosPessoais;
    private javax.swing.JLabel labelEmail;
    private javax.swing.JLabel labelEndereco;
    private javax.swing.JLabel labelNome;
    private javax.swing.JLabel labelRua;
    private javax.swing.JLabel labelSobrenome;
    private javax.swing.JLabel labelTelefone1;
    private javax.swing.JLabel labelTelefone2;
    private javax.swing.JLabel labelUF;
}
